<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>     
        let xhr = new XMLHttpRequest;
        xhr.open('GET', 'http://phpclub.org.cn/edu/server/news.php');
        xhr.send();
        let ulDom = document.createElement('ul');
        document.body.appendChild(ulDom);
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4 && xhr.status == 200) {
                let html = '';
                JSON.parse(xhr.responseText).data.forEach((item) => {
                    html += `<li class='${item.id}'>${item.title}</li>`;
                });
                ulDom.innerHTML = html;
                ulDom.onclick = function (event) {
                    let id = event.target.className;
                    let p = '';
                    p = `<p>${JSON.parse(xhr.responseText).data[Math.abs(id-6)].content}</p>`
                    document.body.innerHTML= p;
                    let textDom=document.createElement('textarea');
                    let btnDom=document.createElement('button');
                    btnDom.innerHTML='send';
                    document.body.appendChild(textDom);
                    document.body.appendChild(btnDom);
                }
            }
        }
    </script>
</body>
</html>